package com.vtuzx.kingdee.xqc_api.service;

import com.vtuzx.core.VtuzxException;
import com.vtuzx.core.bean.dto.VtuzxMap;
import com.vtuzx.core.bean.dto.VtuzxToken;
import com.vtuzx.web.bean.VtuzxDownloadBean;
import org.bson.Document;
import org.bson.types.ObjectId;

import javax.print.Doc;
import java.util.List;
import java.util.Map;

/**
 * 采购服务
 */
public interface IXqcSyncKingdeeOrderService {


    void syncPurInOrder(ObjectId userId, String name, String billNo, String source) throws Exception;

    void syncPurInOrderBn(ObjectId userId, String name, String billNo, String source) throws Exception;

    VtuzxMap getSyncOrderHistory(ObjectId userId, String name, Map<String, Object> param);

    void syncOtherInOrder(ObjectId userId, String name, String billNo, String source) throws Exception;

    /**
     * 同步其他出库单
     * @param userId
     * @param name
     * @param billNo
     * @param source
     * @throws VtuzxException
     */
    void syncOtherOutOrder(ObjectId userId, String name, String billNo, String source) throws Exception;

    /**
     * 同步其他出库单主流程
     * @param history
     * @throws VtuzxException
     */
    void syncOtherOutOrderInner(Document history) throws Exception;

    /**
     * 重推
     * @param token
     * @param id
     * @throws Exception
     */
    void retry(VtuzxToken token, String id) throws Exception;

    /**
     * 同步生产订单
     * @param userId
     * @param name
     * @param billNo
     * @param source
     * @throws VtuzxException
     */
    void syncPrdOrder(ObjectId userId, String name, String billNo, String source,String taskTime) throws Exception;

    /**
     * 同步生产订单BN
     * @param userId
     * @param name
     * @param billNo
     * @param source
     * @throws VtuzxException
     */
    void syncPrdOrderBn(ObjectId userId, String name, String billNo, String source,String taskTime) throws Exception;

    /**
     * 同步生产领料单(半成品)
     * @param userId
     * @param name
     * @param billNo
     * @param source
     * @throws Exception
     */
    void syncPrdPickOrder(ObjectId userId, String name, String billNo, String source,String pickTime) throws Exception;

    /**
     * 同步生产领料单(半成品)BN
     * @param userId
     * @param name
     * @param billNo
     * @param source
     * @throws Exception
     */
    boolean syncPrdPickOrderBn(ObjectId userId, String name, String billNo, String pickBillNo, String source,String pickTime, boolean uploadFlag) throws Exception;

    /**
     * 同步入库单
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncPrdInStockOrder(ObjectId userId, String name, String billNo, String source,String prdInTime) throws Exception;

    /**
     * 同步入库单BN
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncPrdInStockOrderBn(ObjectId userId, String name, String billNo, String source,String prdInTime) throws Exception;

    /**
     * 同步生产订单(分选)
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    List<String> syncPrdOrderSorting(ObjectId userId, String name, String billNo, String source, List<Map<String, Object>> boxList,String taskTime) throws Exception;

    /**
     * 同步生产订单(分选)BN
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    List<String> syncPrdOrderSortingBn(ObjectId userId, String name, String billNo, String source, List<Map<String, Object>> boxList,String taskTime) throws Exception;

    /**
     * 同步生产领料单（分选）
     * @param userId
     * @param name
     * @param billNo
     * @param source
     * @param boxList
     * @throws Exception
     */
    void syncPrdPickOrderSorting(ObjectId userId, String name, String billNo, String source, List<Map<String, Object>> boxList,String pickTime) throws Exception;

    /**
     * 同步生产领料单（分选）BN
     * @param userId
     * @param name
     * @param billNo
     * @param source
     * @param boxList
     * @throws Exception
     */
    void syncPrdPickOrderSortingBn(ObjectId userId, String name, String billNo, String source, List<Map<String, Object>> boxList,String pickTime) throws Exception;

    /**
     * 同步入库单（分选）
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncPrdInStockOrderSorting(ObjectId userId, String name, String billNo, String source,String prdInTime) throws Exception;

    /**
     * 同步入库单（分选）BN
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncPrdInStockOrderSortingBn(ObjectId userId, String name, String billNo, String source,String prdInTime) throws Exception;

    /**
     * 调拨单（分选）
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncStockTransferOrder(ObjectId userId, String name, String billNo, String source,String taskTime) throws Exception;

    /**
     * 调拨单（分选）BN
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncStockTransferOrderBn(ObjectId userId, String name, String billNo, String source,String taskTime) throws Exception;


    /**
     * 调拨单（网页/pda调拨）
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncStockTransferOrderMain(ObjectId userId, String name, String billNo, String source) throws Exception;

    /**
     * 生产补料
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncPrdReplenishment(ObjectId userId, String name, String billNo, String source,String supplementTime) throws Exception;

    /**
     * 生产补料BN
     * @param userId
     * @param name
     * @param supplementList
     * @param source
     */
    /*void syncPrdReplenishmentBn(ObjectId userId, String name, String billNo, String source,String supplementTime) throws Exception;*/
    //补料单调整：合并多个补料单中的物料，只需传一次补料
    void syncPrdReplenishmentBn(ObjectId userId, String name, List<Document> supplementList, String source, String supplementTime) throws Exception;

    /**
     * 生产退料
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncPrdReturn(ObjectId userId, String name, String billNo, String source) throws Exception;

    void syncSaleOut(ObjectId userId, String name, String billNo, String source) throws Exception;

    //变品传金蝶
    void syncDesaltingInStock(ObjectId userId, String name, String taskBillNo, String billNo, String source,String desaltingTime,int number) throws Exception;

    //变品传金蝶BN
    void syncDesaltingInStockBn(ObjectId userId, String name, String taskBillNo, String billNo, String source,String desaltingTime,int number) throws Exception;

    void syncPurOrderInStock(ObjectId userId, String name, String billNo, String orderNo, String source) throws Exception;


    /**
     * 生产退料(退料入库单)
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncReturn(ObjectId userId, String name, String billNo, String source,String returnTime) throws Exception;

    /**
     * 生产退料(退料入库单)BN
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncReturnBn(ObjectId userId, String name, String billNo, String source,String returnTime) throws Exception;


    /**
     * 其他入库和拆箱批号调整单
     * @param userId
     * @param name
     * @param
     * @param source
     */
    void syncTransferDirectOther(ObjectId userId, String name, String otherInBillNo, String otherOutBillNo,String source) throws Exception;

    /**
     * 采购退货单
     * @param userId
     * @param name
     * @param billNo
     * @param source
     */
    void syncPurOrderReturn(ObjectId userId, String name, String billNo, String source) throws Exception;

    /**
     * 导出订单同步到excle
     * @param token 令牌
     * @param param 参数
     * @return VtuzxDownloadBean 对象
     * @throws Exception 异常
     */
    VtuzxDownloadBean downloadSyncOrderHistory(VtuzxToken token, Map<String, Object> param) throws Exception;

    /**
     * 订单同步外层表
     * @param userId
     * @param name
     * @param param
     * @return
     */
    VtuzxMap getSync(ObjectId userId, String name, Map<String, Object> param);

    /**
     * 根据同步单号导出同步结果
     * @param token
     * @param param
     * @return
     */
    VtuzxDownloadBean downloadSyncHistory(VtuzxToken token, Map<String, Object> param) throws Exception;
}
